//
//  MyTableViewCell.m
//  UI_面包旅行
//
//  Created by 谷萌雨 on 15/12/21.
//  Copyright © 2015年 谷萌雨. All rights reserved.
//

#import "MyTableViewCell.h"
#import "myCollectionViewCell.h"

@interface MyTableViewCell()<UICollectionViewDataSource, UICollectionViewDelegate>

//@property(nonatomic, retain)

@end




@implementation MyTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if(self){
        
        [self creatSubViews];
        
        
    }
    
    return self;
    
}


-(void)creatSubViews{
 
    UICollectionViewFlowLayout *myFlowLayout = [[UICollectionViewFlowLayout alloc] init];
    UICollectionView *myCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 0, 414, 200) collectionViewLayout:myFlowLayout];
    myCollectionView.backgroundColor = [UIColor redColor];
    
    myCollectionView.delegate = self;
    myCollectionView.dataSource = self;
    
    // 添加到视图上去
    [self addSubview:myCollectionView];
    
    [myCollectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    
    
    myFlowLayout.itemSize = CGSizeMake(170, 180);
    myFlowLayout.sectionInset = UIEdgeInsetsMake(2, 2, 2, 2);
    
    
    
    
    
}

-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    
    return 4;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    myCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
    
    
    
    
    return cell;
    
}






- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
